<!DOCTYPE html>
<html class="um landscape min-width-240px min-width-320px min-width-480px min-width-768px min-width-1024px">
<head>
    <title></title>
    <meta charset="utf-8">
    <meta name="viewport" content="target-densitydpi=device-dpi, width=device-width, initial-scale=1, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
    <link rel="stylesheet" href="css/ui-base.css">
    <link rel="stylesheet" href="css/ui-box.css">
    <link rel="stylesheet" href="css/ui-color.css">
	<link rel="stylesheet" href="css/ui-res.css">
	<link rel="stylesheet" href="css/ui-img.css">
    <script src="js/zy_control.js"></script>
    <script src="js/zy_click.js"></script>
	<script src="js/jquery-2.0.0.js"></script>
    <script></script>
</head>
<body class="um-vp c-wh" ontouchstart>
    <div id="page_0" class="up ub ub-ver" tabindex="0">
        <!--header开始-->
       <div id="header" class="uh c-org  t-wh ub" onclick="" style="background-color:#0977d2">
        	<div class="umw4 imgPerData2 btn  uinn btn-l   t-wh" onclick="loadIndex()" ontouchstart="zy_touch(btn-act)" >
            <!--插入按钮控件-->
			
        	</div>
            <h1 class="ut ub-f1 ulev1 ut-s tx-c">发状态</h1>
			<div class="umw4  btn  uinn btn-l  t-wh" onclick="publicNew()" ontouchstart="zy_touch(btn-act)" style="
    background-color: rgb(19, 109, 184);
">
            <!--插入按钮控件-->
			<div  class="tx-c ulev0" onclick="" style="padding:.2em;">发送</div>
        	</div>
        </div>
        <!--header结束--><!--content开始-->
       <div  class="ub" style="
    margin-left: 0.5em;
    margin-right: 0.5em;
    padding-top: 0.6em;
    width: 95%;
    min-height: 13em;
	word-break:break-all;
">
		 <textarea id="New" wrap="hard" onload="txtInit()" placeholder="我要写些什么呢!" type="text" class="shadow  ulev1" style="width: 100%;height: 100%;display: block;min-height: 13em;word-break:break-all;"></textarea>
	</div>
        <!--content结束--><!--footer开始-->
        
        <!--footer结束-->
    </div>
</body>
<script>
zy_init();
window.uexOnload = function(type){
    if (!type) {
        //zy_con("content", "publicNew_content.html", 0, $$("header").offsetHeight);
    }
	window.onorientationchange=window.onresize=function(){
		zy_resize("content",0,$$("header").offsetHeight);	
				
	}
		var txt=document.getElementById("New");
	txt.value="";
	txt.placeholder="我要写些什么呢！";
	txt.focus();
	
}
 function txtInit(){
 	var txt=document.getElementById("New");
	txt.value="";
	txt.placeholder="我要写些什么呢！";
 }
function loadIndex(){
	//uexwindow.windowBack();
		
	uexWindow.open("index",0,"index.html",4,"","",0,250);
	uexWindow.close();
}
function publicNew(){
	var txtArea=document.getElementById("New");
	var txt=txtArea.value;
	 var session_id=window.localStorage.getItem("session_id");
	var httpID=998;
	uexXmlHttpMgr.onData=function(inOpCode,inStatus,inResult){
		if(inStatus==1){
			var json=JSON.parse(inResult);
			if(json["success"]){
				uexWindow.toast(1,5,"发布成功",500);
				uexXmlHttpMgr.close(httpID);
				//uexWindow.windowBack();
				loadIndex();
				//uexWindow.open("percenter",0,"percenter.html",5,"","",0,600);
				
			}
			else{
				if(json["error_code"]==401)//指session_id过期的情况下，自动登录
				{
					autologin();
				}
				uexWindow.toast(1,5,"发布失败",500);
				uexXmlHttpMgr.close(httpID);
			}
		}
	};
	uexXmlHttpMgr.open(httpID,'post','http://tm.ourstu.com/api.php/document/newDocument',30000);
	if(txt==$$("New").placeholder||txt=="")
	{
		uexWindow.open("percenter",0,"percenter.html",5,"","",0,600);
	}
	else{
		uexWindow.toast(1,5,"保存中...",500);
		uexXmlHttpMgr.setPostData(httpID,'0','content',txt);
		uexXmlHttpMgr.setPostData(httpID,'0','session_id',session_id);
		uexXmlHttpMgr.send(httpID);
	}
}
</script>
</html>
